<template>
	<view>
		<!-- 弹窗 -->
		<u-popup :show="showDeliveryPopup" mode="center" :round="10" @close="closeDeliveryPopup" closeable
			@open="openDeliveryPopup" :safeAreaInsetBottom="false">
			<view style="padding: 20rpx;width: 500rpx;">
				<u--text type="success" text="配送信息" bold align="center" margin="20rpx 0"></u--text>
				<uni-forms ref="form" :modelValue="formData" label-width="80">
					<uni-forms-item label="用户名称">
						<input class="input dis-flex align-items-center" style="height: 36px;" v-model="formData.name"
							disabled />
					</uni-forms-item>
					<uni-forms-item label="订单号">
						<input v-model="formData.order_sn" disabled class="input dis-flex align-items-center"
							style="height: 36px;" />
					</uni-forms-item>
					<uni-forms-item label="订单金额">
						<input class="input dis-flex align-items-center" style="height: 36px;"
							v-model="formData.order_mount" disabled />
					</uni-forms-item>
					<uni-forms-item label="配送员">
						<uni-data-select v-model="formData.did" :localdata="deliverymanRange"></uni-data-select>
					</uni-forms-item>
					<button type="primary" @click="comfirmDelivery" style="margin: 30rpx 0 0 0;">提交</button>
				</uni-forms>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		props: {
			formData: Object,
			deliverymanRange: Array
		},
		data() {
			return {
				showDeliveryPopup: false,
			}
		},
		onLoad(e) {

		},
		methods: {
			// 打开配送弹窗
			openDeliveryPopup() {
				this.showDeliveryPopup = true
			},
			closeDeliveryPopup() {
				this.showDeliveryPopup = false
			},
			// 选择配送员
			comfirmDelivery() {
				if (!this.formData.did) {
					uni.showToast({
						title: '请选择配送员',
						icon: 'none'
					})
					return
				}
				this.$emit('comfirmDelivery', this.formData)
			}
		}
	}
</script>

<style>
</style>